<template>
  <div class='article-item' v-if="article">
    <p class="title"  @click="$router.push(`/article/${article.id}`)">{{ article.title }}</p>
    <div class="main">
      <img :src="article.cover" alt="">
      <p>{{ article.excerpt }}</p>
    </div>
    <span>{{ article.createdAt | timeFormat }}</span>
  </div>
</template>

<script>
export default {
  name: 'MyAtricleItem',
  props: {
    article: {
      type: Object,
      default: () => { }
    }
  },
  data () {
    return {}
  },
  components: {},
  methods: {},
  created () { },
  mounted () { }
}
</script>

<style lang='less' scoped>
.article-item {
  box-shadow: 0 2px 5px 1px rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  padding: 20px;
  margin-bottom: 20px;
  transition: all 0.3s;

  &:hover {
    box-shadow: 0 3px 8px 1px rgba(0, 0, 0, 0.2);
  }
}

.title {
  margin-bottom: 20px;
  font-size: 22px;

  &:hover {
    cursor: pointer;
    color: #0d6efd;
  }
}

.main {
  height: 160px;
  display: flex;

  img {
    display: flex;
    width: 240px;
    height: 120px;
    border: 1px solid rgb(224, 223, 223);
    margin-right: 20px;
    border-radius: 4px;
    margin-top: 10px;
  }

  p {
    font-size: 16px;
    color: #6c757d;
  }
}

span {
  font-size: 14px;
  color: #6c757d;
}
</style>
